
<template>
  <div>
    <div style="color: #4380ea"><h3>基本信息</h3></div>
    <div>
      <el-form
        :inline="true"
        label-position="left"
        label-width="92px"
        :model="formInline.membersNew"
        :rules="rules"
        class="demo-form-inline"
        ref="formInline.membersNew"
        size="mini"
        style="background: #fff"
      >
        <el-row
          style="border-bottom: 1px solid #f2f2f2"
          type="flex"
          class="row-bg"
        >
          <el-col :span="20">
            <el-row
              type="flex"
              align="center"
              style="padding: 0 10px"
              :gutter="20"
            >
              <el-col :span="4">
                <el-form-item label="姓名" prop="memberName">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.memberName"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="性别"
                  style="padding-left: 30px"
                  prop="sex"
                >
                  <el-select
                    v-model="formInline.membersNew.sexCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="4">
                <el-form-item label="身高" style="padding-left: 60px">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.height"
                    clearable
                  >
                    <template slot="append">cm</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="体重" style="padding-left: 90px">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.weight"
                    clearable
                  >
                    <template slot="append">kg</template></el-input
                  >
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="BMI" style="padding-left: 120px">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.bmi"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="手机号"
                  style="padding-left: 150px"
                  prop="phone"
                >
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.phone"
                    clearable
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="4">
                <el-form-item label="证件类型" >
                  <el-select
                    v-model="formInline.membersNew.contactType"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                    
                  >
                    <el-option
                      v-for="item in options1"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="证件号码" style="padding-left: 30px">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.idcardNo"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="出生日期"
                  style="padding-left: 60px"
                
                  prop="birthday"
                >
                  <el-date-picker
                    v-model="formInline.membersNew.birthday"
                    style="width: 180px"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>

              <el-col :span="4">
                <el-form-item label="国籍" style="padding-left: 90px">
                  <el-select
                    v-model="formInline.membersNew.memNationalityCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options2"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="民族" style="padding-left: 120px">
                  <el-select
                    v-model="formInline.membersNew.memNationCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options3"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="婚姻状态" style="padding-left: 150px">
                  <el-select
                    v-model="formInline.membersNew.memMaritalCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options4"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="4">
                <el-form-item label="医保类型">
                  <el-select
                    v-model="formInline.membersNew.memMedicalInsuranceTypeCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options8"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="医保账号" style="padding-left: 30px">
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.memMedicalInsuranceNo"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="文化程度" style="padding-left: 60px">
                  <el-select
                    v-model="formInline.membersNew.memEducationBackgroundCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options10"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="职业状态" style="padding-left: 90px">
                  <el-select
                    v-model="formInline.membersNew.memJobStatusCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options11"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="4">
                <el-form-item label="所在省份" prop="label">
                  <el-select
                    v-model="formInline.membersNew.memProvinceCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="(item, index) in options5"
                      :key="index"
                      :label="item.label"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="所在市" style="padding-left: 30px">
                  <el-select
                    v-model="formInline.membersNew.memCityCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="(item, index) in options6"
                      :key="index"
                      :label="item.label"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="所在区" style="padding-left: 60px">
                  <el-select
                    v-model="formInline.membersNew.memAreaCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="(item, index) in options7"
                      :key="index"
                      :label="item.label"
                      :value="item.id"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="详细输入" style="padding-left: 90px">
                  <el-input
                    style="width: 300px"
                    v-model="formInline.membersNew.address"
                    clearable
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="4">
                <el-form-item
                  label="患者类型"
                  prop="memPatTypeCode"
                  label-width="92px"
                >
                  <el-select
                    v-model="formInline.membersNew.memPatTypeCode"
                    :disabled="disabled"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options12"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="慢病等级" style="padding-left: 30px">
                  <el-select
                    v-model="formInline.membersNew.memChronicDiseaseGradeCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options13"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="随访形式" style="padding-left: 60px">
                  <el-select
                    v-model="formInline.membersNew.memFollowWayCode"
                    placeholder="请选择下拉选择"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options14"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="随访计划"
                  style="padding-left: 90px"
                  label-width="92px"
                  prop="planId"
                >
                  <el-select
                    v-model="formInline.membersNew.planId"
                    :disabled="disabled"
                    placeholder="必须选择随访计划"
                    clearable
                    style="width: 180px"
                  >
                    <el-option
                      v-for="item in options15"
                      :key="item.planId"
                      :label="item.planName"
                      :value="item.planId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="20">
                <el-form-item label="设备类型">
                  <el-checkbox-group
                    v-model="formInline.membersNew.memDeviceTypeCodesArray"
                  >
                    <el-checkbox
                      v-for="item in options16"
                      :label="item.code"
                      :key="item.name"
                      >{{ item.name }}</el-checkbox
                    >
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="20" style="padding: 0 10px">
              
              <el-col :span="4"  >
                <el-form-item label="创建账号">
                  <el-input
                    type="text"
                    oninput="value=value.endsWith('.')?value: parseFloat('0'+value);if(value>=8)value=8"
                    maxlength="4"
                    show-word-limit
                    style="width: 180px"
                    placeholder="输入用药依从性评分"
                    v-model="formInline.membersNew.memMoriskyScaleCreate"
                    clearable
                  />
                  
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="三个月后" style="padding-left: 30px">
                  <el-input
                    type="text"
                    oninput="value=value.endsWith('.')?value: parseFloat('0'+value);if(value>=8)value=8"
                    maxlength="4"
                    show-word-limit
                    style="width: 180px"
                    placeholder="输入用药依从性评分"
                    v-model="formInline.membersNew.memMoriskyScaleThreeMonths"
                    clearable
                  />
                </el-form-item>
                <!-- oninput="if(value>=8)value=8" -->
              </el-col>
              <el-col :span="4">
                <el-form-item label="六个月后" style="padding-left: 60px">
                  <el-input
                    type="text"
                    oninput="value=value.endsWith('.')?value: parseFloat('0'+value);if(value>=8)value=8"
                    maxlength="4"
                    show-word-limit
                    style="width: 180px"
                    placeholder="输入用药依从性评分"
                    v-model="formInline.membersNew.memMoriskyScaleSixMonths"
                    clearable
                  />
                </el-form-item>
              </el-col>
            
           
            
            </el-row>








<el-row :gutter="20" style="padding: 0 10px">
              
             
              
             
              <el-col :span="4">
                <el-form-item label="患者账号" >
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.memAccount"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="初始密码"
                              style="padding-left: 30px"
                  v-if="thepassword1"
                >
                  <el-input
                    style="width: 180px"
                    v-model="formInline.membersNew.password"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item
                  label="重置密码"
                                      style="padding-left: 30px"
                  v-if="thepassword2"
                >
                  <el-input
                    style="width: 180px"
                           v-model="formInline.membersNew.passwords"
                    clearable
                  />
                </el-form-item>
              </el-col>
              <el-col :span="9" >
                <el-form-item label="患者家属" style="margin-left:60px;margin-top:25px">
                  <el-radio-group
                    v-model="formInline.membersNew.memIsFamily"
                    size="medium"
                  >
                    <el-radio
                      v-for="(item, index) in field101Options"
                      :key="index"
                      :label="item.value"
                      :disabled="item.disabled"
                      @change="getRadioVal"
                      >{{ item.label }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>



  <!-- <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="9">
                <el-form-item label="患者家属">
                  <el-radio-group
                    v-model="formInline.membersNew.memIsFamily"
                    size="medium"
                  >
                    <el-radio
                      v-for="(item, index) in field101Options"
                      :key="index"
                      :label="item.value"
                      :disabled="item.disabled"
                      @change="getRadioVal"
                      >{{ item.label }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row> -->
            <!--   当是患者家属的时候-->
            <div class="spacing" v-show="form_items_status">
              <el-row :gutter="20" style="padding: 0 10px">
                <el-col :span="4">
                  <el-form-item label="患者家属">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.contactsc1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="与患者关系"
                    label-width="88px"
                    style="padding-left: 30px"
                  >
                    <el-select
                      v-model="
                        formInline.membersNew
                          .memContactsc1FamilyRelationshipCode
                      "
                      placeholder="请选择下拉选择"
                      clearable
                      style="width: 180px"
                    >
                      <el-option
                        v-for="item in options20"
                        :key="item.code"
                        :label="item.name"
                        :value="item.code"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="联系电话" style="padding-left: 60px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.cphone1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="家属账号" style="padding-left: 90px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.caccount1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="初始密码" style="padding-left: 120px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.cpassword1"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
            <!--   当不是患者家属的时候-->
            <div class="spacing" v-show="form_items_statuss">
              <el-row :gutter="20" style="padding: 0 10px">
                <el-col :span="4">
                  <el-form-item label="紧急联系人" label-width="92px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.contactsc1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="与患者关系"
                    label-width="88px"
                    style="padding-left: 30px"
                  >
                    <el-select
                      v-model="
                        formInline.membersNew
                          .memContactsc1FamilyRelationshipCode
                      "
                      placeholder="请选择下拉选择"
                      clearable
                      style="width: 180px"
                    >
                      <el-option
                        v-for="item in options20"
                        :key="item.code"
                        :label="item.name"
                        :value="item.code"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="联系电话" style="padding-left: 60px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.cphone1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="联系人账号"
                    style="padding-left: 90px"
                    label-width="92px"
                  >
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.caccount1"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item label="初始密码" style="padding-left: 120px">
                    <el-input
                      style="width: 180px"
                      v-model="formInline.membersNew.cpassword1"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <div style="margin-left: 20px; color: #4380ea"><h3>疾病信息</h3></div>

        <el-row
          style="border-bottom: 1px solid #f2f2f2"
          type="flex"
          class="row-bg"
        >
          <el-col :span="20">
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="20">
                <el-form-item label="主要疾病" prop="field101">
                  <el-checkbox-group
                    v-model="formInline.membersNew.memDiseaseInfoCodesArray"
                    size="medium"
                  >
                    <el-checkbox
                      v-for="item in options17"
                      :label="item.name"
                      :key="item.name"
                      >{{ item.name }}</el-checkbox
                    >
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="20">
                <el-form-item label="药物不良反应史" label-width="120px">
                  <el-input
                    v-model="formInline.membersNew.memUntowardEffect"
                    type="textarea"
                    placeholder="请输入多行文本药物不良反应历史"
                    :autosize="{ minRows: 4, maxRows: 4 }"
                    style="width: 1200px"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="5">
                <el-form-item label="吸烟" label-width="42px">
                  <el-radio-group
                    v-model="formInline.membersNew.memIsSmoking"
                    size="medium"
                  >
                    <el-radio
                      v-for="(item, index) in field101Options2"
                      :key="index"
                      :label="item.value"
                      :disabled="item.disabled"
                      >{{ item.label }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="喝酒" label-width="42px">
                  <el-radio-group
                    v-model="formInline.membersNew.memIsDrink"
                    size="medium"
                  >
                    <el-radio
                      v-for="(item, index) in field101Options3"
                      :key="index"
                      :label="item.value"
                      :disabled="item.disabled"
                      >{{ item.label }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="24">
                <el-form-item label="家族史">
                  <el-checkbox-group
                    v-model="formInline.membersNew.memOccurrenceSiteCodesArray"
                    size="medium"
                    @change="toobtain1"
                  >
                    <el-checkbox
                      v-for="item in options18"
                      :label="item.name"
                      :key="item.name"
                      >{{ item.name }}</el-checkbox
                    >
                    <el-input
                      style="width: 300px; margin-left: 20px"
                      v-if="history1"
                      v-model="formInline.membersNew.memOccurrenceSiteRemark"
                      placeholder="多个病症请用中文“，”隔开"
                      clearable
                    />
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="20" style="padding: 0 10px">
              <el-col :span="24">
                <el-form-item label="现存其他疾病" label-width="98px">
                  <el-checkbox-group
                    v-model="formInline.membersNew.memRadiationAreaCodesArray"
                     @change="toobtain2"
                    size="medium"
                  >
                    <el-checkbox
                      v-for="item in options19"
                      :label="item.name"
                      :key="item.name"
                      >{{ item.name }}</el-checkbox
                    >
                    <el-input
                      style="width: 300px; margin-left: 20px"
                      v-if="history2"
                      v-model="formInline.membersNew.memRadiationAreaRemark"
                      placeholder="多个病症请用中文“，”隔开"
                      clearable
                    />
                  </el-checkbox-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <div style="margin-left: 20px; color: #4380ea">
          <h3><span @dblclick="shijian">作</span>息时间设置</h3>
        </div>
        <el-form
          :inline="true"
          label-position="left"
          label-width="68px"
          :model="formInline.jst002ComPatientmodelNew"
          :rules="rules"
          class="demo-form-inline"
          ref="formInline.jst002ComPatientmodelNew"
          size="mini"
          style="background: #fff"
        >
          <el-row
            id="Glu"
            style="height: 60px; border-bottom: 1px solid #f2f2f2"
            type="flex"
            class="row-bg"
          >
            <el-col :span="24" style="display: flex; padding-left: 15px">
              <el-row :gutter="20" style="padding: 0 10px">
                <el-col :span="4">
                  <el-form-item
                    label="晨起时间"
                    prop="morningRiseTime"
                    label-width="92px"
                  >
                    <el-time-select
                      style="width: 180px"
                      v-model="
                        formInline.jst002ComPatientmodelNew.morningRiseTime
                      "
                      :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }"
                      placeholder="选择时间"
                    >
                    </el-time-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="早餐时间"
                    prop="breakfastTime"
                    label-width="92px"
                  >
                    <el-time-select
                      style="width: 180px"
                      v-model="
                        formInline.jst002ComPatientmodelNew.breakfastTime
                      "
                      :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }"
                      placeholder="选择时间"
                    >
                    </el-time-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="午餐时间"
                    prop="lunchTime"
                    label-width="92px"
                  >
                    <el-time-select
                      style="width: 180px"
                      v-model="formInline.jst002ComPatientmodelNew.lunchTime"
                      :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }"
                      placeholder="选择时间"
                    >
                    </el-time-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="晚餐时间"
                    prop="dinnerTime"
                    label-width="92px"
                  >
                    <el-time-select
                      style="width: 180px"
                      v-model="formInline.jst002ComPatientmodelNew.dinnerTime"
                      :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }"
                      placeholder="选择时间"
                    >
                    </el-time-select>
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item
                    label="睡眠时间"
                    prop="goingTime"
                    label-width="92px"
                  >
                    <el-time-select
                      style="width: 180px"
                      v-model="formInline.jst002ComPatientmodelNew.goingTime"
                      :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }"
                      placeholder="选择时间"
                    >
                    </el-time-select>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-col>
          </el-row>
        </el-form>
      </el-form>
      <el-button
        type="primary"
        @click="search()"
        style="width: 180px; display: block; margin: 0 auto; margin-top: 20px"
        >保 存</el-button
      >
    </div>
  </div>
</template>
<script>
import { addbasicinformation } from "@/api/follow-up/follow-up-records"; //基本信息新增接口
import { echodisplays } from "@/api/follow-up/follow-up-records"; //基本信息回显显示接口
import { modifybasicinformation } from "@/api/follow-up/follow-up-records"; //基本信息修改接口
import { administrativeregion } from "@/api/follow-up/follow-up-records"; //行政区
import { domaininterface } from "@/api/follow-up/follow-up-records"; //值域接口
import { followupplan } from "@/api/follow-up/follow-up-records"; //随访计划
export default {
  name: "the-basic-information",
  components: {},
  props: ["patId", "memPatTypeCodes", "planId"],
  data() {
    return {
      comCodeList: new Map(),
      checkedCities: [],
      history1:false,
      history2:false,
      formInline: {
        membersNew: {
          memberName: "", //姓名
          name: "",
          sex: "", //性别
          sexCode: "",
          age: "", //年龄
          height: "", //身高
          weight: "", //体重
          contactType: "", //证件类型
          memNationalityCode: "", //国籍
          memNationCode: "", //民族
          memMaritalCode: "", //婚姻状态
          memMedicalInsuranceTypeCode: "", //医保类型
          memMedicalInsuranceNo: "", //医保账号
          memEducationBackgroundCode: "", //文化程度
          memJobStatusCode: "", //职业状态
          memPatType: "", //患者类型
          memPatTypeCode: "",
          memChronicDiseaseGradeCode: "", //慢病等级
          bmi: "", //BMI
          phone: "",
          memFollowWay: "", //随访形式
          memFollowWayCode: "",
          planId: "",
          idcardNo: "", //证件号码
          birthday: "", //出生日期
          address: "", //详细输入
          memProvinceCode: "", //省
          memProvince: "",
          memCityCode: "", //市
          memCity: "",
          memAreaCode: "", //区
          memArea: "",
          memMoriskyScaleCreate: "", //创建账号
          memMoriskyScaleThreeMonths: "", //三个月后
          memMoriskyScaleSixMonths: "", //六个月后
          memAccount: "", //患者账号
          password: "", //初始密码
          contactsc1: "", //患者家属和紧急联系人
          memContactsc1FamilyRelationshipCode: "", //与患者关系
          cphone1: "", //联系电话
          caccount1: "", //家属账号和联系人电话
          cpassword1: "", //初始密码
          memUntowardEffect: "", //不良反应历
          memOccurrenceSiteRemark: "", //其他备注
          memRadiationAreaRemark: "", //其他备注
          memUntowardEffect: "", //不良反应史
          memDeviceTypeCodesArray: [], //设备类型
          memDiseaseInfoCodesArray: [], //主要疾病
          memOccurrenceSiteCodesArray: [], //家族史
          memRadiationAreaCodesArray: [], //现存其他疾病
          mainDiseases:"", //主要疾病   
          family:"",//家族病史    
          past:"",//以往病史
          memIsSmoking: "", //是否吸烟
          memIsDrink: "",
          communityId: "",
          memIsFamily: ""
        },
        jst002ComPatientmodelNew: {
          morningRiseTime: "",
          breakfastTime: "",
          lunchTime: "",
          dinnerTime: "",
          goingTime: ""
        },
        jst002ComPatientmodels: []
      },
      value: "",
      thepassword1: true,
      thepassword2: false,
      form_items_status: true,
      form_items_statuss: false,
      accordingto: true,
      disabled: false,
      options: [],
      options1: [],
      options2: [],
      options3: [],
      options4: [],
      options5: [],
      options6: [],
      options7: [],
      options8: [],
      options10: [],
      options11: [],
      options12: [],
      options13: [],
      options14: [],
      options15: [],
      options16: [],
      options17: [],
      options18: [],
      options19: [],
      options20: [],
      id: "",
      status: 3, // tab状态
      field101Options: [
        {
          label: "是",
          value: 1
        },
        {
          label: "否",
          value: 0
        }
      ],
      field101Options2: [
        {
          label: "是",
          value: 1
        },
        {
          label: "否",
          value: 0
        }
      ],
     
      field101Options3: [
        {
          label: "是",
          value: 1
        },
        {
          label: "否",
          value: 0
        }
      ],

      rules: {
        memberName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "change"
          }
        ],
        sex: [
          {
            required: true,
            message: "请选择性别",
            trigger: "change"
          }
        ],

        birthday: [
          {
            required: true,
            message: "请选择出生日期",
            trigger: "change"
          }
        ],
        memPatTypeCode: [
          {
            required: true,
            message: "请选择患者类型",
            trigger: "change"
          }
        ],
        planId: [
          {
            required: true,
            message: "请选择随访计划",
            trigger: "change"
          }
        ],
        phone: [
          {
            required: true,
            message: "请输入手机号",
            trigger: "change"
          }
        ],
        morningRiseTime: [
          {
            required: true,
            message: "请输入晨起时间",
            trigger: "change"
          }
        ],
        breakfastTime: [
          {
            required: true,
            message: "请输入早餐时间",
            trigger: "change"
          }
        ],
        lunchTime: [
          {
            required: true,
            message: "请输入午餐时间",
            trigger: "change"
          }
        ],
        dinnerTime: [
          {
            required: true,
            message: "请输入晚餐时间",
            trigger: "change"
          }
        ],
        goingTime: [
          {
            required: true,
            message: "请输入睡眠时间",
            trigger: "change"
          }
        ]
      }
    };
  },
  computed: {},
  created() {},
  mounted() {
   
    this.getDeptData();
    this.getDeptData1();
    this.getDeptData2();
    this.getDeptData3();
    this.getDeptData4();
    this.getDeptData5();
    this.getDeptData8();
    this.getDeptData10();
    this.getDeptData11();
    this.getDeptData12();
    this.getDeptData13();
    this.getDeptData14();
    this.getDeptData15();
    this.getDeptData16();
    this.getDeptData17();
    this.getDeptData18();
    this.getDeptData19();
    this.getDeptData20();
    this.getRadioValss();
    
    if (this.patId) {
      // console.log(this.patId,"----------------")
      this.initSelectCategoryss(this.patId);
      this.accordingto = false;
      this.disabled = true;
    } else {
      this.formInline = {
        membersNew: {
          memberName: "",
          sex: "",
          sexCode: "",
          age: "",
          height: "",
          weight: "",
          phone: "",
          contactType: "",
          memNationality: "",
          memNationalityCode: "",
          memNation: "",
          memNationCode: "",
          memMarital: "",
          memMaritalCode: "",
          memMedicalInsuranceTypeCode: "",
          memMedicalInsuranceNo: "",
          memEducationBackgroundCode: "",
          memJobStatus: "",
          memJobStatusCode: "",
          memPatType: "",
          memPatTypeCode: "",
          memChronicDiseaseGradeCode: "",
          bmi: "",
          memFollowWay: "",
          memFollowWayCode: "",
          planId: "",
          idcardNo: "",
          birthday: "",
          address: "",
          memProvinceCode: "",
          memProvince: "",
          memCityCode: "",
          memCity: "",
          memAreaCode: "",
          memArea: "",
          memMoriskyScaleCreate: "",
          memMoriskyScaleThreeMonths: "",
          memMoriskyScaleSixMonths: "",
          memAccount: "",
          password: "",
          contactsc1: "",
          memContactsc1FamilyRelationshipCode: "", //与患者关系
          cphone1: "",
          caccount1: "",
          cpassword1: "",
          memUntowardEffect: "",
          memOccurrenceSiteRemark: "",
          memRadiationAreaRemark: "",
          memDeviceTypeCodesArray: [], //设备类型
          memDiseaseInfoCodesArray: [], //主要疾病
          memOccurrenceSiteCodesArray: [], //家族史
          memRadiationAreaCodesArray: [], //现存其他疾病
          memIsFamily: 0,
          memIsSmoking: 0,
          memIsDrink: 0
        },
        jst002ComPatientmodelNew: {
          morningRiseTime: "",
          breakfastTime: "",
          lunchTime: "",
          dinnerTime: "",
          goingTime: ""
        }
      };
    }
  },
  methods: {
    
    membersNew: function() {},
    //是否是患者家属单选按钮点击事件
    getRadioValss() {
      if (this.formInline.membersNew.memIsFamily == 1) {
        this.form_items_status = true;
        this.form_items_statuss = false;
      } else if (this.formInline.membersNew.memIsFamily == 0) {
        this.form_items_status = false;
        this.form_items_statuss = true;
      }
    },
    getRadioVal() {
      if (this.formInline.membersNew.memIsFamily == 1) {
        this.form_items_status = true;
        this.form_items_statuss = false;
      } else if (this.formInline.membersNew.memIsFamily == 0) {
        this.form_items_status = false;
        this.form_items_statuss = true;
      }
    },

    //性别下拉选
    getDeptData() {
      let params = {
        rangeCode: "sex"
      };
      domaininterface(params).then(res => {
        this.options = res.data;
        this.comCodeList.set(
          "sex",
          this.arrayToMap(this.options, this.keyAction, this.valueAction)
        );
      });
    },
    //证件类型
    getDeptData1() {
      let params = {
        rangeCode: "credentials_type"
      };
      domaininterface(params).then(res => {
        this.options1 = res.data;
        this.comCodeList.set(
          "credentials_type",
          this.arrayToMap(this.options1, this.keyAction, this.valueAction)
        );
      });
    },
    //国籍
    getDeptData2() {
      let params = {
        rangeCode: "nationality"
      };
      domaininterface(params).then(res => {
        this.options2 = res.data;
        this.comCodeList.set(
          "memNationality",
          this.arrayToMap(this.options2, this.keyAction, this.valueAction)
        );
      });
    },
    //民族
    getDeptData3() {
      let params = {
        rangeCode: "ethnicity"
      };
      domaininterface(params).then(res => {
        this.options3 = res.data;
        this.comCodeList.set(
          "memNation",
          this.arrayToMap(this.options3, this.keyAction, this.valueAction)
        );
      });
    },

    //婚姻状态
    getDeptData4() {
      let params = {
        rangeCode: "pat_marital"
      };
      domaininterface(params).then(res => {
        this.options4 = res.data;
        this.comCodeList.set(
          "pat_marital",
          this.arrayToMap(this.options4, this.keyAction, this.valueAction)
        );
      });
    },
    //行政区下拉选
    getDeptData5() {
      administrativeregion().then(res => {
        this.options5 = res;

        //选择某个省
        if (this.formInline.membersNew.memProvinceCode) {
          // alert(1);
          //循环找省
          for (let index in this.options5) {
            //找到了
            if (
              this.options5[index].id ===
              this.formInline.membersNew.memProvinceCode
            ) {
              //设置市名称
              console.log(this.formInline.membersNew.memCityCode, "找到了");
              this.formInline.membersNew.memProvince = this.options5[
                index
              ].label;
              console.log(this.formInline.membersNew.memCityCode, "找到了-9");
              //下级市节点给到《所在市 下拉选》
              this.options6 = this.options5[index].children;
              console.log(this.options6, "找到了6");
              console.log(this.formInline.membersNew.memCityCode, "找到了+9");

              //  this.formInline.membersNew.memCityCode = this.options5[index].children[index].label;
              //  console.log( this.formInline.membersNew.memCityCode,"找到了7")

              break;
            }
          }
        }
        if (this.formInline.membersNew.memCityCode) {
          // alert(1);
          //循环找省
          for (let index in this.options6) {
            //找到了
            if (
              this.options6[index].id === this.formInline.membersNew.memCityCode
            ) {
              //设置市名称
              console.log(this.formInline.membersNew.memAreaCode, "找到了");
              this.formInline.membersNew.memProvince = this.options6[
                index
              ].label;
              console.log(this.formInline.membersNew.memAreaCode, "找到了-9");
              //下级市节点给到《所在市 下拉选》
              this.options7 = this.options6[index].children;
              console.log(this.options7, "找到了6");
              console.log(this.formInline.membersNew.memAreaCode, "找到了+9");

              //  this.formInline.membersNew.memCityCode = this.options5[index].children[index].label;
              //  console.log( this.formInline.membersNew.memCityCode,"找到了7")

              break;
            }
          }
        }
      });
    },
    //医保类型
    getDeptData8() {
      let params = {
        rangeCode: "medical_insurance_type"
      };
      domaininterface(params).then(res => {
        this.options8 = res.data;
        this.comCodeList.set(
          "medical_insurance_type",
          this.arrayToMap(this.options8, this.keyAction, this.valueAction)
        );
      });
    },

    //文化程度
    getDeptData10() {
      let params = {
        rangeCode: "culture_degree"
      };
      domaininterface(params).then(res => {
        this.options10 = res.data;
        this.comCodeList.set(
          "culture_degree",
          this.arrayToMap(this.options10, this.keyAction, this.valueAction)
        );
      });
    },
    //职业状态
    getDeptData11() {
      let params = {
        rangeCode: "professional_status"
      };
      domaininterface(params).then(res => {
        this.options11 = res.data;
        this.comCodeList.set(
          "professional_status",
          this.arrayToMap(this.options11, this.keyAction, this.valueAction)
        );
      });
    },
    //患者类型
    getDeptData12() {
      let params = {
        rangeCode: "pat_type"
      };
      domaininterface(params).then(res => {
        this.options12 = res.data;
        this.comCodeList.set(
          "pat_type",
          this.arrayToMap(this.options12, this.keyAction, this.valueAction)
        );
      });
    },
    //慢病等级
    getDeptData13() {
      let params = {
        rangeCode: "chronic_disease_grade"
      };
      domaininterface(params).then(res => {
        this.options13 = res.data;
        this.comCodeList.set(
          "chronic_disease_grade",
          this.arrayToMap(this.options13, this.keyAction, this.valueAction)
        );
      });
    },
    //随访形式
    getDeptData14() {
      let params = {
        rangeCode: "follow_way"
      };
      domaininterface(params).then(res => {
        this.options14 = res.data;
        this.comCodeList.set(
          "follow_way",
          this.arrayToMap(this.options14, this.keyAction, this.valueAction)
        );
      });
    },
    //随访计划
    getDeptData15() {
      followupplan().then(res => {
        this.options15 = res.data;
        // this.comCodeList.set(
        //   "followupplan",
        //   this.arrayToMap(this.options15, this.keyAction, this.valueAction)
        // );
      });
    },
    //多选设备类型
    getDeptData16() {
      let params = {
        rangeCode: "device_type"
      };
      domaininterface(params).then(res => {
        this.options16 = res.data;
      });
    },
    //多选主要疾病
    getDeptData17() {
      let params = {
        rangeCode: "disease_info"
      };
      domaininterface(params).then(res => {
        this.options17 = res.data;
      });
    },
    //多选家族历
    getDeptData18() {
      let params = {
        rangeCode: "occurrence_site"
      };
      domaininterface(params).then(res => {
        this.options18 = res.data;
      });
    },
    //多选现存其他疾病
    getDeptData19() {
      let params = {
        rangeCode: "radiation_area"
      };
      domaininterface(params).then(res => {
        this.options19 = res.data;
      });
    },
    //与患者关系
    getDeptData20() {
      let params = {
        rangeCode: "family_relationship"
      };
      domaininterface(params).then(res => {
        this.options20 = res.data;
      });
    },

    //显示
    initSelectCategoryss(id) {
      let params = {
        id: id
      };
      // alert(id)
      echodisplays(params).then(res => {
        this.formInline.membersNew = res.data;

        this.thepassword2 = true;
        this.thepassword1 = false;
        //遍历作息时间
        let len = res.data.jst002ComPatientmodels.length;
        let jst002ComPatientmodels = res.data.jst002ComPatientmodels;
        for (let i = 0; i < len; i++) {
          let isExist = false;
          //遍历每个作息时间
          let jst002ComPatientmodel = jst002ComPatientmodels[i];
          let timeStr = jst002ComPatientmodel.timePoint.split(" ")[1];
          let time = timeStr.substring(0, timeStr.lastIndexOf(":"));
          if (jst002ComPatientmodel.phyType === "682") {
            //晨起时间 682
            this.formInline.jst002ComPatientmodelNew.morningRiseTime = time;
            //添加到修改集合
            isExist = true;
          } else if (jst002ComPatientmodel.phyType === "684") {
            //早饭中 684
            this.formInline.jst002ComPatientmodelNew.breakfastTime = time;
            //添加到修改集合
            isExist = true;
          } else if (jst002ComPatientmodel.phyType === "687") {
            //午饭后 687
            this.formInline.jst002ComPatientmodelNew.lunchTime = time;
            //添加到修改集合
            isExist = true;
          } else if (jst002ComPatientmodel.phyType === "690") {
            //晚饭后 690
            this.formInline.jst002ComPatientmodelNew.dinnerTime = time;
            //添加到修改集合
            isExist = true;
          } else if (jst002ComPatientmodel.phyType === "794") {
            //睡觉  794
            this.formInline.jst002ComPatientmodelNew.goingTime = time;
            //添加到修改集合
            isExist = true;
          }
          if (isExist) {
            this.formInline.jst002ComPatientmodels.push(jst002ComPatientmodel);
          }
        }
        this.formInline.membersNew.planId = this.planId;

        //性别
        if (this.formInline.membersNew.sex) {
          this.$set(
            this.formInline.membersNew,
            "sexCode",
            this.findNameByCode("sex", this.formInline.membersNew.sex)
          );
        }
        //市

        // //区
        // if (this.formInline.membersNew.memProvinceCode) {
        //   this.$set(
        //     this.formInline.membersNew,
        //     "memAreaCode",
        //     this.findNameByCode(
        //       "memAreaCode",
        //       this.formInline.membersNew.memAreaCode
        //     )
        //   );
        // }

        //重新强制渲染
        if (this.formInline.membersNew.memDeviceTypeCodes) {
          this.$set(
            this.formInline.membersNew,
            "memDeviceTypeCodesArray",
            this.formInline.membersNew.memDeviceTypeCodes.split(",")
          );
        } else {
          this.$set(this.formInline.membersNew, "memDeviceTypeCodesArray", []);
        }
        console.log(this.formInline.membersNew.memCityCode, "找到了+9");
        if (this.formInline.membersNew.memDiseaseInfoCodes) {
          this.$set(
            this.formInline.membersNew,
            "memDiseaseInfoCodesArray",
            this.formInline.membersNew.memDiseaseInfoCodes.split(",")
          );
        } else {
          this.$set(this.formInline.membersNew, "memDiseaseInfoCodesArray", []);
        }
        console.log(this.formInline.membersNew.memCityCode, "找到了+9");
        if (this.formInline.membersNew.memOccurrenceSiteCodes) {
          this.$set(
            this.formInline.membersNew,
            "memOccurrenceSiteCodesArray",
            this.formInline.membersNew.memOccurrenceSiteCodes.split(",")
          );
        } else {
          this.$set(
            this.formInline.membersNew,
            "memOccurrenceSiteCodesArray",
            []
          );
        }
        console.log(this.formInline.membersNew.memCityCode, "找到了+9");
        if (this.formInline.membersNew.memRadiationAreaCodes) {
          this.$set(
            this.formInline.membersNew,
            "memRadiationAreaCodesArray",
            this.formInline.membersNew.memRadiationAreaCodes.split(",")
          );
        } else {
          this.$set(
            this.formInline.membersNew,
            "memRadiationAreaCodesArray",
            []
          );
        }
        console.log(this.formInline.membersNew.memCityCode, "找到了+9");
        this.formInline.membersNew.memChronicDiseaseGradeCode += "";
        this.formInline.membersNew.memPatTypeCode = this.memPatTypeCodes;
        this.formInline.membersNew.planId = this.planId;

        console.log(
          this.formInline.membersNew.memPatTypeCode,
          "this.memPatTypeCodes哈哈哈"
        );
        console.log(this.patId, "this.patId哈哈哈");
        console.log(this.formInline.membersNew.memCityCode, "找到了+9");
      });
    },

    /**
     * 根据name查找code
     * @param rangeCode 值域码
     * @param name name名称
     */
    findNameByCode(rangeCode, name) {
      let comCodeListLet = this.comCodeList.get(rangeCode);
      //遍历Map
      let iterator = comCodeListLet.entries();
      let obj = null;
      while ((obj = iterator.next().value) != null) {
        //名称相同
        if (obj[1] === name) {
          return obj[0];
        }
      }
      return null;
    },
    getEXDSJGS(time) {
      return "1970-01-01 " + time + ":00";
    },
    //小彩蛋
    shijian() {
      this.formInline = {
        membersNew: {
          memberName: "张三",
          sex: "男",
          sexCode: "1",
          age: "123",
          height: "123",
          weight: "123",
          phone: "1333333",
          contactType: "1",
          memNationality: "中国",
          memNationalityCode: "1",
          memNation: "藏族",
          memNationCode: "10",
          memMarital: "已婚",
          memMaritalCode: "2",
          memMedicalInsuranceTypeCode: "2",
          memMedicalInsuranceNo: "123",
          memEducationBackgroundCode: "01",
          memJobStatus: "失业",
          memJobStatusCode: "2",
          memPatType: "筛查-低危",
          memPatTypeCode: "1",
          memChronicDiseaseGradeCode: "0",
          bmi: 0.008130081300813009,
          memFollowWay: "电话",
          memFollowWayCode: "2",
          planId: 16,
          idcardNo: "213",
          birthday: "2020-10-06",
          address: "123",
          memProvinceCode: "",
          memProvince: "",
          memCityCode: "",
          memCity: "",
          memAreaCode: "",
          memArea: "",
          memMoriskyScaleCreate: "1.1",
          memMoriskyScaleThreeMonths: "2.2",
          memMoriskyScaleSixMonths: "3.3",
          memAccount: "患者账号",
          password: "初始密码",
          contactsc1: "张三",
          memContactsc1FamilyRelationshipCode: "1", //与患者关系
          cphone1: "0000",
          caccount1: "1333333",
          cpassword1: "00000",
          memUntowardEffect: "心脏病",
          memOccurrenceSiteRemark: "哈哈啊1",
          memRadiationAreaRemark: "哈哈啊2",
          memDeviceTypeCodesArray: ["1", "2"], //设备类型
          memDiseaseInfoCodesArray: ["1", "2"], //主要疾病
          memOccurrenceSiteCodesArray: ["1", "2", "9"], //家族史
          memRadiationAreaCodesArray: ["1", "2", "17"], //现存其他疾病
          memIsFamily: 1,
          memIsSmoking: 1,
          memIsDrink: 1
        },
        jst002ComPatientmodelNew: {
          morningRiseTime: "06:30",
          breakfastTime: "09:30",
          lunchTime: "12:30",
          dinnerTime: "15:30",
          goingTime: "18:30"
        }
      };
    },
    //保存
    search(formName) {
      //let tabOne = true;
      if (this.patId) {
        this.formInline.membersNew.password = this.formInline.membersNew.passwords;
      }

      this.formInline.membersNew.memDeviceTypeCodes = this.formInline.membersNew.memDeviceTypeCodesArray.join();
      this.formInline.membersNew.memDiseaseInfoCodes = this.formInline.membersNew.memDiseaseInfoCodesArray.join();
       //修改主要疾病
       let a2 =this.formInline.membersNew.memDiseaseInfoCodes;
       this.formInline.membersNew.mainDiseases=a2.replace(/,/g, "|")

      this.formInline.membersNew.memOccurrenceSiteCodes = this.formInline.membersNew.memOccurrenceSiteCodesArray.join();
      //修改家族史
       let a1 =this.formInline.membersNew.memOccurrenceSiteCodes;
       let b1 =this.formInline.membersNew.memOccurrenceSiteRemark
       let d1 ="~"+b1
       let c1 =a1.concat(d1)
       this.formInline.membersNew.family=c1.replace(/,/g, "|")
       //修改现存其他疾病
       this.formInline.membersNew.memRadiationAreaCodes = this.formInline.membersNew.memRadiationAreaCodesArray.join();
       let a3 =this.formInline.membersNew.memRadiationAreaCodes;
       let b3 =this.formInline.membersNew.memRadiationAreaRemark
       let d3 ="~"+b3
       let c3 =a3.concat(d3)
       this.formInline.membersNew.past=c3.replace(/,/g, "|")

      this.formInline.membersNew.name = this.formInline.membersNew.memberName;
      this.formInline.membersNew.communityId = "123456";
      if (this.formInline.membersNew.birthday != "") {
        if (!this.formInline.membersNew.birthday.endsWith("00:00:00")) {
          this.formInline.membersNew.birthday += " 00:00:00";
        }
      }

      if (this.patId) {
        //遍历作息时间
        let len = this.formInline.jst002ComPatientmodels.length;
        let jst002ComPatientmodels = this.formInline.jst002ComPatientmodels;
        for (let i = 0; i < len; i++) {
          //遍历每个作息时间
          let jst002ComPatientmodel = jst002ComPatientmodels[i];
          if (jst002ComPatientmodel.phyType === "682") {
            //晨起时间 682
            jst002ComPatientmodel.timePoint = this.getEXDSJGS(
              this.formInline.jst002ComPatientmodelNew.morningRiseTime
            );
          } else if (jst002ComPatientmodel.phyType === "684") {
            //早饭中 684
            jst002ComPatientmodel.timePoint = this.getEXDSJGS(
              this.formInline.jst002ComPatientmodelNew.breakfastTime
            );
          } else if (jst002ComPatientmodel.phyType === "687") {
            //午饭后 687
            jst002ComPatientmodel.timePoint = this.getEXDSJGS(
              this.formInline.jst002ComPatientmodelNew.lunchTime
            );
          } else if (jst002ComPatientmodel.phyType === "690") {
            //晚饭后 690
            jst002ComPatientmodel.timePoint = this.getEXDSJGS(
              this.formInline.jst002ComPatientmodelNew.dinnerTime
            );
          } else if (jst002ComPatientmodel.phyType === "794") {
            //睡觉  794
            jst002ComPatientmodel.timePoint = this.getEXDSJGS(
              this.formInline.jst002ComPatientmodelNew.goingTime
            );
          }
        }

        let params = this.formInline;
        modifybasicinformation(params).then(res => {
          this.$message({
            message: "修改成功",
            type: "success"
          });
          console.log("走到这里了1");
        });
      } else {
        if (
          this.formInline.membersNew.memberName == "" ||
          this.formInline.membersNew.sexCode == "" ||
          this.formInline.membersNew.birthday == "" ||
          this.formInline.membersNew.memPatTypeCode == "" ||
          this.formInline.membersNew.planId == "" ||
          this.formInline.membersNew.phone == "" ||
          this.formInline.jst002ComPatientmodelNew.morningRiseTime == "" ||
          this.formInline.jst002ComPatientmodelNew.breakfastTime == "" ||
          this.formInline.jst002ComPatientmodelNew.lunchTime == "" ||
          this.formInline.jst002ComPatientmodelNew.dinnerTime == "" ||
          this.formInline.jst002ComPatientmodelNew.goingTime == ""
        ) {
          const rule1 = new Promise((resolve, reject) => {
            this.$refs["formInline.membersNew"].validate(valid => {
              if (valid) {
                resolve();
              } else {
                // reject('error submit!!')
                console.log("error submit!!");
                return false;
              }
            });
          });
          const rule2 = new Promise((resolve, reject) => {
            this.$refs["formInline.jst002ComPatientmodelNew"].validate(
              valid => {
                if (valid) {
                  resolve();
                } else {
                  console.log("error submit!!");
                  return false;
                }
              }
            );
          });
          Promise.all([rule1, rule2]).then(() => {
            //进行的操作
          });
        } else {
          let params = this.formInline;
          addbasicinformation(params)
            .then(res => {
              if (res.code == 200) {
                this.$message({
                  message: "保存成功",
                  type: "success"
                });

                this.$emit("savebutton", false);
              }
              this.$emit("thevalueof", res.data.id);
            })
            .catch(err => {
              // console.log(err.response.data.message, "err1");
              //this.commonErr(err)
            });
        }
      }
    },

    // commonErr(err) {
    //   if (err.response.status == 500) {
    //     if (err.response.data.code == 500) {
    //       let errArr = Object.values(err.response.data.data);
    //       this.$message({
    //         message: errArr[0],
    //         type: "warning"
    //       });
    //     } else {
    //       this.$message({
    //         message: err.response.data.message,
    //         type: "warning"
    //       });
    //     }
    //   } else {
    //     this.$message({
    //       message: "未知的错误",
    //       type: "warning"
    //     });
    //   }
    // },
     toobtain1:function(e){
       let a=e.indexOf("其他")
        if(a>=0){
         this.history1=true
       }else{
         this.history1=false
       }
     
     },
      toobtain2:function(e){
       let a=e.indexOf("其他")
        if(a>=0){
         this.history2=true
       }else{
         this.history2=false
       }
     
     },
    //Key取值通用方法
    keyAction(item) {
      return item.code;
    },
    //Value取值通用方法
    valueAction(item) {
      return item.name;
    },
    /**
     * Array转Map
     * arrayObj 数组对象
     * keyAction key取值方法
     * valueAction value取值方法
     */
    arrayToMap(arrayObj, keyAction, valueAction) {
      console.log(arrayObj);
      let res = new Map();
      //arrayObj=res.4
      let length = arrayObj.length;
      for (let i = 0; i < length; i++) {
        console.log("------" + arrayObj[i] + "------");
        res.set(keyAction(arrayObj[i]), valueAction(arrayObj[i]));
      }
      return res;
    },
    arrayGetValue(arrayObj, code) {
      for (let obj in arrayObj) {
        console.log("arrayGetValue--------", code, obj);
        if (code === obj.code) {
          return obj.name;
        }
      }
      return "";
    }
  },
  watch: {
    //身高监听 - 计算BMI
    // "formInline.membersNew.height": {
    //   handler: function(newVal, oldVal) {
    //     if (this.formInline.membersNew.weight) {
    //       this.bmi = this.membersNew.formInline.weight / Math.pow(newVal, 2);

    //       console.log(this.bmi, "this.bmi身高");
    //     }
    //   },
    //   deep: true
    // },
    "formInline.membersNew.memProvinceCode": {
      handler: function(newVal, oldVal) {
        //选择某个省
        if (newVal) {
          //循环找省
          for (let index in this.options5) {
            // console.log(this.options5[index])
            // console.log(this.options5[index].id === this.formInline.memProvinceCode)
            //找到了
            if (
              this.options5[index].id ===
              this.formInline.membersNew.memProvinceCode
            ) {
              //设置市名称
              this.formInline.membersNew.memProvince = this.options5[
                index
              ].label;
              //下级市节点给到《所在市 下拉选》
              this.options6 = this.options5[index].children;
              //清空之前选择项
              this.$set(this.formInline.membersNew, "memCityCode", "");
              this.$set(this.formInline.membersNew, "memAreaCode", "");
              break;
            }
          }
        }
      },

      deep: true
    },
    "formInline.membersNew.memCityCode": {
      handler: function(newVal, oldVal) {
        //选择某个区
        if (this.formInline.membersNew.memCityCode) {
          //循环找区
          for (let index in this.options6) {
            // console.log(this.options6[index])
            // console.log(this.options6[index].id === this.formInline.memCityCode)
            //找到了
            if (
              this.options6[index].id === this.formInline.membersNew.memCityCode
            ) {
              //设置区名称
              this.formInline.membersNew.memCity = this.options6[index].label;
              //下级区节点给到《所在区 下拉选》
              this.options7 = this.options6[index].children;
              //清空之前选择项
              this.$set(this.formInline.membersNew, "memAreaCode", "");
              break;
            }
          }
        }
      },

      deep: true
    },
    "formInline.membersNew.memAreaCode": {
      handler: function(newVal, oldVal) {
        if (this.formInline.membersNew.memAreaCode) {
          //循环找区
          for (let index in this.options7) {
            // console.log(this.options7[index])
            // console.log(this.options7[index].id === this.formInline.memAreaCode)
            //找到了
            if (
              this.options7[index].id === this.formInline.membersNew.memAreaCode
            ) {
              //设置区名称
              this.formInline.membersNew.memArea = this.options7[index].label;
              break;
            }
          }
        }
      },

      deep: true
    },
    //体重监听 - 计算BMI
    "formInline.membersNew.weight": {
      handler: function(newVal, oldVal) {
        let height = this.formInline.membersNew.height / 100;
        console.log(this.formInline.membersNew.height / 100, "得到身高1");
        if (height) {
          console.log(height, "得到身高2");

          this.formInline.membersNew.bmi = newVal / Math.pow(height, 2);
          this.formInline.membersNew.bmi = this.formInline.membersNew.bmi.toFixed(
            2
          );
          console.log(this.formInline.membersNew.bmi, "this.bmi体重");
        }
      },
      deep: true
    },

    //性别下拉选的转换
    "formInline.membersNew.sexCode": {
      deep: true,
      handler(newValue, oldValue) {
        console.log("watch---------------------", newValue);
        if (this.comCodeList.get("sex")) {
          this.formInline.membersNew.sex = this.comCodeList
            .get("sex")
            .get(newValue);
        }
      }
    },

    //随访计划
    "formInline.membersNew.planId": {
      deep: true,
      handler(newValue, oldValue) {
        console.log("watch---------------------", newValue);
        if (this.comCodeList.get("followupplan")) {
          this.formInline.membersNew.planName = this.comCodeList
            .get("followupplan")
            .get(newValue);
        }
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.category_title {
  margin-bottom: 20px;
  display: flex;
  align-items: center;

  margin-top: 20px;
  margin-left: 20px;
}
.shutiao {
  display: inline-block;
  width: 5px;
  height: 20px;
  border-radius: 28%;
  background-color: #4380ea;
  vertical-align: middle;
  margin-right: 6px;
}
.button {
  display: flex;
  margin-left: auto;
}
.tabs_panel {
  display: flex;
  margin-bottom: 30px;
  .tabs_items {
    font-size: 18px;
    font-weight: bold;
    color: #a1a8b3;
    margin-right: 40px;
    cursor: pointer;
    &.active_current {
      color: #4380ea;
    }
  }
}
</style>








